import ifcopenshell
import datetime
import time
from src.ifc.load.load import load_ifc_to_neo4j
from src.ifc.load.save import import_entities
from src.ifc.work.work import calc_work, calc_project_date
from src.ifc.rule.rule import *
from util.applog import AppLog

# TODO 后面改成上传的，不应该写死
file_path = "./src/装配式厂房.ifc"


if __name__ == "__main__":
    # # 解析 IFC 并把数据加载到 NEO4J（含体积计算）
    # load_ifc_to_neo4j(file_path)
    #
    # # 调用规则  排序，虚拟节点添加
    # custom_rule()

    # # 调整部分
    # worker = 2  # 施工人数
    # # 定额、工期计算
    # AppLog.info("定额、工期计算")
    # calc_work(worker)

    # 工期排序
    AppLog.info("工期排序")
    project_date = datetime.datetime.today() + datetime.timedelta(days=1)  # 明天
    calc_project_date(project_date)
    AppLog.info("结束")

    #
    # 方便测试，用于删除指定的关系
    # MATCH ()-[r:CONNECTED_TO|CONTAINS|PLACED_IN]->() DELETE r
    # 删除孤立的节点
    # MATCH (n) WHERE NOT (n)--() DELETE n
    # 删除虚拟节点
    # MATCH (n:Virtual) DELETE n
